home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / GuiCtrlSetGraphic.au3 < prev    next >
Text File  |  2007-09-08  |  3KB  |  108 lines

  1. #include <GUIConstants.au3>
  2.     
  3. $MAXGr=7
  4. Global $a[$MAXGr+1]    ; 0 and $MAXGr entries not used to allow GUICtrlDelete result
  5. Global $child, $del
  6.  
  7. GUICreate("My Main", -1,-1,100,100)
  8. $del1=GuiCtrlCreateButton("Delete", 50,200, 50)
  9. GUISetState()
  10. CreateChild()
  11.  
  12. $i=1
  13. $inc=1
  14. ;$i=5    ; uncomment to delete starting from last define Graphic control
  15. ;$inc=-1
  16.  
  17. Do
  18.     $msg = GUIGetMsg()
  19.     if $msg= $del1 then Del()
  20.  
  21.     if $msg= $del then
  22.         GuiCtrlDelete($a[$i])
  23.         $i = $i+$inc
  24.         if $i <0 OR $i>$MAXGr then exit
  25.     EndIf
  26. Until $msg=$GUI_EVENT_CLOSE
  27.  
  28. Func Del()
  29.     GuiDelete($child)
  30.     CreateChild()
  31. EndFunc
  32.  
  33. Func CreateChild()
  34. $child=GUICreate("My Draw")
  35. $del=GuiCtrlCreateButton("Delete", 50,165, 50)
  36.  
  37. $a[1]=GuiCtrlCreateGraphic(20, 50, 100,100)
  38. GUICtrlSetBkColor(-1,0xffffff)
  39. GUICtrlSetColor(-1,0)
  40. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff0000,0xff0000)
  41. GUICtrlSetGraphic(-1,$GUI_GR_PIE, 50,50, 40,30,270)
  42. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xffffff)
  43. GUICtrlSetGraphic(-1,$GUI_GR_PIE, 58,50, 40,-60,90)
  44.  
  45. GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 100,100, 50,80)
  46. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xc0c0ff)
  47. GUICtrlSetGraphic(-1,$GUI_GR_RECT, 350,200, 50,80)
  48. GuiCtrlCreateLabel("label", 65, 100, 30)
  49. GUICtrlSetColor(-1,0xff)
  50.  
  51. $a[2]=GuiCtrlCreateGraphic(220, 10, 100,100)
  52.  
  53. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0, 0xff)
  54. GUICtrlSetGraphic(-1,$GUI_GR_PIE, 50,50, 40,30,270)
  55. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xffffff)
  56. GUICtrlSetGraphic(-1,$GUI_GR_PIE, 58,50, 40,-60,90)
  57.  
  58. $a[3]=GuiCtrlCreateGraphic(220, 110, 100,100)
  59. GUICtrlSetBkColor(-1,0xf08080)
  60. GUICtrlSetColor(-1,0xff)
  61. GUICtrlSetGraphic(-1,$GUI_GR_HINT, 1)
  62.  
  63. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff00)
  64. GUICtrlSetGraphic(-1,$GUI_GR_RECT, 50,50, 80,80)
  65.  
  66. $a[4]=GuiCtrlCreateGraphic(20, 200, 80,80)
  67. GUICtrlSetBkColor(-1,0xffffff)
  68. GUICtrlSetGraphic(-1,$GUI_GR_HINT, 1)
  69.  
  70. GUICtrlSetGraphic(-1,$GUI_GR_MOVE, 10,10)
  71. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff)
  72. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 30,40)
  73. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff00)
  74. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 70,70)
  75. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff0000)
  76. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 10,50)
  77. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xffff00)
  78. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 10,10)
  79.  
  80. $a[5]=GuiCtrlCreateGraphic(150, 10, 50,50)
  81. GUICtrlSetBkColor(-1,0xa0ffa0)
  82. GUICtrlSetGraphic(-1,$GUI_GR_MOVE, 20,20)        ; start point
  83. ; it is better to draw line and after point
  84. ; to avoid to switch color at each drawing
  85. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x0000ff)
  86. GUICtrlSetGraphic(-1,$GUI_GR_DOT, 30,30)
  87. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0)
  88. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 20,40)
  89. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff0000)
  90. GUICtrlSetGraphic(-1,$GUI_GR_DOT, 25,25)
  91. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0)
  92. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 40,40)
  93. GUICtrlSetGraphic(-1,$GUI_GR_DOT, 30,40)
  94.  
  95. $a[6]=GuiCtrlCreateGraphic(110, 260, 230,130)
  96. GUICtrlSetColor(-1,0)                        ; to display a balck border line
  97. GUICtrlSetBkColor(-1,0xc0c0ff)
  98. GUICtrlSetGraphic(-1,$GUI_GR_HINT, 3)        ; to display control lines and end points
  99.  
  100. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0, 0xff); fill in blue
  101. GUICtrlSetGraphic(-1,$GUI_GR_MOVE, 120,20)        ; start point
  102. GUICtrlSetGraphic(-1,$GUI_GR_BEZIER, 120,100, 200,20, 200,100)
  103. GUICtrlSetGraphic(-1,$GUI_GR_BEZIER+$GUI_GR_CLOSE, 100,40, 40,100, 40,20)
  104. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 60,30)        ; start point
  105.  
  106. GuiSetState()
  107. EndFunc
  108.